package modelo.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
    private SessionFactory factory;
    
    public HibernateUtil(Class classe){
        AnnotationConfiguration cfg = new AnnotationConfiguration();
        cfg.addAnnotatedClass(classe);
        cfg.configure();
        factory = cfg.buildSessionFactory();
    }
    public Session getSession() {
        return factory.openSession();
    }
}